import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Home',
      redirect: '/users',
      component: () => import('../views/Home.vue'),
      children: [
        {
          path: '/users',
          name: '用户管理',
          meta: {
            iconType: 'UserFilled'
          },
          children: [
            {
              path: '',
              name: '用户查询',
              component: () => import('../views/users/index.vue'),
            },
            {
              path: 'add',
              name: '用户添加',
              component: () => import('../views/users/AddView.vue'),
            }
          ],
        },
        {
          path: '/deps',
          name: '部门管理',
          meta: {
            iconType: 'Briefcase',
          },
          children: [
            {
              path: '',
              name: '部门查询',
              component: () => import('../views/deps/index.vue'),
            },
            {
              path: 'add',
              name: '添加部门',
              component: () => import('../views/deps/AddView.vue'),
            }
          ],
        },
        {
          path: '/positions',
          name: '职位管理',
          meta: {
            iconType: 'Discount',
          },
          children: [
            {
              path: '',
              name: '职位查询',
              component: () => import('../views/positions/index.vue'),
            },
            {
              path: 'add',
              name: '添加职位',
              component: () => import('../views/positions/AddView.vue'),
            }
          ],
        },
        {
          path: '/employees',
          name: '员工管理',
          meta: {
            iconType: 'Avatar',
          },
          children: [
            {
              path: '',
              name: '员工查询',
              component: () => import('../views/employees/index.vue'),
            },
            {
              path: 'add',
              name: '添加员工',
              component: () => import('../views/employees/AddView.vue'),
            }
          ]
        },
        {
          path: '/notices',
          name: '公告管理',
          meta: {
            iconType: 'Memo',
          },
          children: [
            {
              path: '',
              name: '公告查询',
              component: () => import('../views/notices/index.vue'),
            },
            {
              path: 'add',
              name: '添加公告',
              component: () => import('../views/notices/AddView.vue'),
            }
          ]
        },
        {
          path: '/download',
          name: '下载中心',
          meta: {
            iconType: 'Download',
          },
          children: [
            {
              path: '',
              name: '文档查询',
              component: () => import('../views/download/index.vue')
            },
            {
              path: 'upload',
              name: '添加文档',
              component: () => import('../views/download/UploadView.vue')
            }
          ]
        },
      ],
    },

    {
      path: '/login',
      name: 'Login',
      component: () => import('../views/Login.vue')
    }
  ],
})

export default router
